package com.netsdk.lht2.util;

import com.netsdk.demo.util.sql.EventDto;
import com.netsdk.lib.NetSDKLib;
import com.netsdk.lib.enumeration.EM_CLASS_TYPE;

public class EventDtoUtil {

    public static EventDto toEventDto(NetSDKLib.DEV_EVENT_TRAFFIC_FLOW_STATE msg,
                                      NetSDKLib.NET_TRAFFIC_FLOW_STATE netTrafficFlowState){
        EventDto e = new EventDto();
        e.setEvent_name("交通流量事件");
        e.setEvent_code("385");
        e.setChannel(msg.nChannelID+"");
        e.setEvent_time(msg.UTC.toStringTime());
        e.setEvent_utc_time(msg.UTC.toStringTime());
        e.setEvent_id(msg.nEventID+"");
        e.setPreset_id(msg.stuIntelliCommInfo.nPresetID+"");
        e.setEvent_class(EM_CLASS_TYPE.getNoteByValue(msg.stuIntelliCommInfo.emClassType));
        e.setStop_vehicle_num(msg.nStopVehiclenum+"");
        e.setDetection_area_vehicle_num(msg.nDetectionAreaVehicleNum+"");
        e.setFacePicture("");
        //状态值
        System.out.println("状态值 1- 流量过大 2- 流量过大恢复 3- 正常 4- 流量过小  5- 流量过小恢复 "
                + netTrafficFlowState.dwState);
        e.setDwState( netTrafficFlowState.dwState+"");
        System.out.println("车道方向信息 " + netTrafficFlowState.stTrafficFlowDir.emDrivingDir);
        e.setEmDrivingDir(netTrafficFlowState.stTrafficFlowDir.emDrivingDir+"");
        //平均车速
        System.out.println("平均车速,单位km/h " + netTrafficFlowState.fAverageSpeed);
        e.setfAverageSpeed(netTrafficFlowState.fAverageSpeed+"");

        System.out.println("大车交通量 " + netTrafficFlowState.nLargeVehicles);
        e.setnLargeVehicles(netTrafficFlowState.nLargeVehicles+"");

        System.out.println("中型车交通量 " + netTrafficFlowState.nMediumVehicles);
        e.setnMediumVehicles(netTrafficFlowState.nMediumVehicles+"");

        System.out.println("小车交通量 " + netTrafficFlowState.nSmallVehicles);
        e.setnSmallVehicles(netTrafficFlowState.nSmallVehicles+"");

        System.out.println("左转： " + netTrafficFlowState.nLeftVehicles);
        e.setnLeftVehicles(netTrafficFlowState.nLeftVehicles+"");
        System.out.println("右转 " + netTrafficFlowState.nRightVehicles);
        e.setnRightVehicles(netTrafficFlowState.nRightVehicles+"");
        System.out.println("直行 " + netTrafficFlowState.nStraightVehicles);
        e.setnStraightVehicles(netTrafficFlowState.nStraightVehicles+"");

        e.setnUTurnVehicles( netTrafficFlowState.nUTurnVehicles+"");
        return  e;
    }
}
